#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5005;
const int MOD = 998244353;
const int MX = 5001;

int n, m;
int a[N];
ll dp[N];
ll ans;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> a[i];
  sort(a + 1, a + n + 1);
  rep(i, 0, MX) dp[i] = 1;
  rep(i, 1, n) {
    ans = (ans + (dp[MX] - dp[a[i]] + MOD)) % MOD;
    dp[MX] = (dp[MX] + dp[MX]) % MOD;
    per(j, MX - 1, a[i]) dp[j] = (dp[j] + dp[j - a[i]]) % MOD;
  }
  cout << ans;
  return 0;
}